<template>
  <div class="commity">
    <div class="commit-content">
      <div class="top">
        <div class="l-title">
          <span
            v-for="(item, index) in tabArr"
            :key="index"
            :class="{ active: activeIndex == index }"
            @click="changeTab(index)"
            >{{ item.label }}</span
          >
        </div>
        <div class="r-icon">
          <img src="@img/message.png" alt="" />
        </div>
      </div>
      <div v-if="activeIndex == 0">
        <!-- 同事圈 -->
        <colleagueCircle />
      </div>
      <div v-if="activeIndex == 1">
        <!-- 问答 -->
        <questions />
      </div>
      <div v-if="activeIndex == 2">
        <!-- 话题 -->
        <talk />
      </div>
    </div>
  </div>
</template>

<script>
import colleagueCircle from "./colleague-circle/index.vue";
import questions from "./questions/index.vue";
import talk from "./talk/index.vue"
export default {
  name: "Community",
  components: {
    colleagueCircle,
    questions,
    talk,
  },
  data() {
    return {
      tabArr: [
        {
          label: "同事圈",
        },
        {
          label: "问答",
        },
        {
          label: "话题",
        },
      ],
      activeIndex: 0,
    };
  },
  methods: {
    changeTab(index) {
      this.activeIndex = index;
    },
  },
};
</script>

<style scoped lang="scss">
.commity {
  .commit-content {
    height: 100vh;
    background: url(@/assets/images/bg.png) 100% no-repeat;
    background-size: 100% 100%;
    .top {
      padding: 4px 16px 16px;
      display: flex;
      .l-title {
        flex: 1;
        span {
          font-family: PingFangSC, PingFang SC;
          font-weight: 400;
          font-size: 14px;
          color: #676b6b;
          line-height: 20px;
          text-align: left;
          font-style: normal;
          margin-right: 16px;
          padding: 4px 0;
        }
        .active {
          font-family: PingFangSC, PingFang SC;
          font-weight: 500;
          font-size: 20px;
          color: #171a1d;
          line-height: 28px;
          text-align: left;
          font-style: normal;
          border-bottom: 6px solid #00d0ab;
        }
      }
      .r-icon {
        width: 51px;
        text-align: right;
        img {
          width: 24px;
          height: 24px;
        }
      }
    }
  }
}
</style>
